<?php
namespace app\admin\controller;
use app\service\apiinvoiceService;
use think\Controller;

class Invoicetest extends Controller{
    public function apply(){
        $api=new apiinvoiceService();
        $data["m_short_name"]="ZZKJ";
        $data["m_name"]="早早科技有限公司";
        $data["logo_info"]="";
        
        $data["sub_m_short_name"]="ZZKJ_SHOP";
        $data["sub_m_name"]="早早科技有限公司";
        $data["register_no"]="早早科技有限公司";
        $data["pid"]="2088031574378734";
        $data["industry"]="life_payment";
        $data["MERCHANT_OPEN_URL"]="https://www.wuye.zfbzhsq.com/admin/aliinvoice/invoice";
        $data["product_code"]="PAYMENT_OPEN";
        $data["s_short_name"]="早早科技";
        $data["pid"]="早早科技有限公司";
        $res=$api->merchantapply(json_encode($data));
        var_dump($res);
        
    }
    public function getimg(){
        $img = '/www/wwwroot/zaozao/zzfqLogo.png';
        $base64_img = $this->base64EncodeImage($img);
        var_dump($base64_img);
        echo $base64_img;
    }
    
    public function base64EncodeImage ($image_file) {
        $base64_image = '';
        $image_info = getimagesize($image_file);
        $image_data = fread(fopen($image_file, 'r'), filesize($image_file));
        $base64_image = 'data:' . $image_info['mime'] . ';base64,' . chunk_split(base64_encode($image_data));
        return $base64_image;
    }
}